package stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class Student {

    private String name;
    private int age;
    private String gen;

    public Student(String name, int age, String gen) {
        this.name = name;
        this.age = age;
        this.gen = gen;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", gen='" + gen + '\'' +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGen() {
        return gen;
    }

    public void setGen(String gen) {
        this.gen = gen;
    }

    public static List<Student> getStudents(){
        ArrayList<Student> list = new ArrayList<>();
        Student student1 = new Student("张三",15,"男");
        Student student2 = new Student("李四",19,"女");
        Student student3 = new Student("王五",13,"男");
        Student student4 = new Student("赵六",12,"女");
        Student student5 = new Student("钱七",15,"男");
        Student student6 = new Student("周八",17,"男");
        Student student7 = new Student("lucy",21,"女");
//        Student student8 = new Student("lucy",21,"女");
        list.add(student1);
        list.add(student2);
        list.add(student3);
        list.add(student4);
        list.add(student5);
        list.add(student6);
        list.add(student7);
//        list.add(student8);
        return list;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return age == student.age && Objects.equals(name, student.name) && Objects.equals(gen, student.gen);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age, gen);
    }
}
